// These are meant to be typed into the REPL. You can also run
// scala -Xnojline < repl-session.scala to run them all at once.
/**
 * 只有文件后缀为 .scala的才能使用package，否则.sc后缀是
 * 一个REPL(Read Eval Print Loop:交互式解释器)文件
 * @param name
 * @param age
 */
//package com.bart.scala.ch09.sec05

class Person(val name: String, val age: Int) {
  override def toString = getClass.getName + "[name=" + name +
    ",age=" + age + "]"
}

/**
 * 只有子类的主构造器才能调用父类主构造器
 * @param name
 * @param age
 * @param salary
 */
class Employee(name: String, age: Int, val salary : Double) extends
  Person(name, age) {
  override def toString = super.toString + "[salary=" + salary + "]"
}



object Main extends App {
  val e = new Employee("Fred", 42, 50000)
  println(e)
}